<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:pom="http://www.pomodorotechnique.com/server">
<xsl:output method="html" />
	
	<xsl:template match="pom:user">
		<input>
			<xsl:if test="@status='closed'"><xsl:attribute name="checked">true</xsl:attribute></xsl:if>
			<xsl:attribute name="title">Started at <xsl:value-of select="@start" />, ended at <xsl:value-of select="@finish" /> (<xsl:value-of select="'XXX'" /> minutes) with <xsl:value-of select="count(pom:interruption)" /> interruptions.</xsl:attribute>
			<xsl:attribute name="type">
				<xsl:if test="@planned='true'">checkbox</xsl:if>
				<xsl:if test="@planned!='true'">radio</xsl:if>
			</xsl:attribute>
		</input>
	</xsl:template>

	<xsl:template match="pom:message">
		<div class="message">Message from <xsl:value-of select="@from" /> at <xsl:value-of select="@when" />: <xsl:value-of select="@text" /></div>
	</xsl:template>

	<xsl:template match="pom:workitem">
		<tr>
			<td>
				<xsl:attribute name="class">wi-<xsl:value-of select="@status" /></xsl:attribute>
				<xsl:value-of select="position()" />
			</td>
			<td>
				<xsl:attribute name="class">wi-<xsl:value-of select="@status" /></xsl:attribute>
				<xsl:value-of select="@title" />
				<xsl:apply-templates select="pom:pomodoro/pom:message" />
			</td>
			<td>
				<xsl:apply-templates select="pom:pomodoro" />
			</td>
		</tr>		
	</xsl:template>

	<xsl:template match="/pom:user">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
			<link rel="stylesheet" type="text/css" href="/ui/ui.css" />
			<title>Pomodoro Client</title>
		</head>
		<body>
			<div align="center">
			<h1><xsl:value-of select="@name" /> (<xsl:value-of select="@id" />)</h1>
			<div>Home | <a><xsl:attribute name="href">/users/<xsl:value-of select="@id" />/plans/2001/03/02</xsl:attribute>Today</a></div>
			<table class="plan" cellspacing="0">
				<tr><th colspan="3" class="plan-header">Plan lists</th></tr>
				<tr>
					<td><a><xsl:attribute name="href">/users/<xsl:value-of select="@id" />/plans/2001/03/02</xsl:attribute>Today</a></td>
					<td colspan="2">See or create a plan for today</td>
				</tr>
				<tr>
					<td><a><xsl:attribute name="href">/users/<xsl:value-of select="@id" />/plans/2001/03</xsl:attribute>Month</a></td>
					<td colspan="2">List all plans for this month</td>
				</tr>
				<tr>
					<td><a><xsl:attribute name="href">/users/<xsl:value-of select="@id" />/plans/2001</xsl:attribute>Year</a></td>
					<td colspan="2">List all plans for this year</td>
				</tr>
				<tr>
					<td><a><xsl:attribute name="href">/users/<xsl:value-of select="@id" />/plans</xsl:attribute>All</a></td>
					<td colspan="2">List all plans</td>
				</tr>
				<tr><th colspan="3" class="plan-header">Settings</th></tr>
				<tr>
					<td>Full name:</td>
					<td><input type="text" size="20"><xsl:attribute name="value"><xsl:value-of select="@name" /></xsl:attribute></input></td>
					<td><input type="button" value="Save" /></td>
				</tr>
				<tr>
					<td>Password:</td>
					<td><input type="password" size="10"></input></td>
					<td><input type="button" value="Save" /></td>
				</tr>
				<tr>
					<td>Pomodoro duration:</td>
					<td><input type="text" size="3"><xsl:attribute name="value"><xsl:value-of select="@pomodoro-length" /></xsl:attribute></input> minutes</td>
					<td><input type="button" value="Save" /></td>
				</tr>
				<tr>
					<td>Break duration:</td>
					<td><input type="text" size="3"><xsl:attribute name="value"><xsl:value-of select="@break-length" /></xsl:attribute></input> minutes</td>
					<td><input type="button" value="Save" /></td>
				</tr>
			</table>
			<p class="copyright">Pomodoro Server 1.0, WSGI implementation<br/>(C) <a href="http://wintermuteblog.blogspot.com/">Constantine Kulak</a>, 2009</p>
			</div>
		</body>
		</html>
	</xsl:template>
</xsl:stylesheet>